import Draw from './Draw.js'
const DEF_STYLE ={
    pixelSize: 10,
    outlineColor: Cesium.Color.BLUE,
    outlineWidth: 5,
    // heightReference:Cesium.HeightReference.RELATIVE_TO_GROUND
}

export default class PointDraw extends Draw{
    constructor(viewer, eventsManager){
        super(viewer ,eventsManager);
        this._delegate =undefined;
        this._position =Cesium.Cartesian3.ZERO;
    }

    _onClick(e){
        console.log(e)

            this._position =this._clampToGround ? e.surfacePosition : e.position
            console.log('click')
            this.unbindEvent()
            this._event.raiseEvent(e)
            let entity =this._viewer.entities.add(this._delegate)
            // this._viewer.zoomTo(entity)
        

    }

    _mountEntity(){
        this._delegate =new Cesium.Entity({
            position: new Cesium.CallbackProperty(()=>{
                return this._position
            },false),
            point:{
                ...DEF_STYLE
            }
        })
        
    }

    _onMouseMove(info){
        console.log(info)
            this._position =info.surfacePosition
            
    }

}